package dao.impl;

import dao.SessionDetailDao;
import domain.ProvinceTop3;
import domain.SessionDetail;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

public class SessionDetailDaoImpl implements SessionDetailDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<SessionDetail> SelectSessionDetail(int userid) {
        String sql = "SELECT userid,pageid,clickCategoryId,clickProductId FROM session_detail  WHERE clickCategoryId != -1 AND clickProductId != -1 AND userid = "+userid+" ORDER BY pageid";
        List<SessionDetail> query = template.query(sql, new BeanPropertyRowMapper<SessionDetail>(SessionDetail.class));
        return query;
    }
}
